class SelectField {
    initOptions(field) {
        field.dataAttribute = {
            multiple: "false",
        };
    }
    getOptionsHtml(field) {
        let html = `
          <div class="form-group">
          <input type="checkbox" id="fieldMultiple"  style="width:100px"  ${field.dataAttribute?.multiple === 'true' ? "checked" : ""} /> 
          <label style="width: 100px; float: inline-start;">是否多选</label>
          </div>
        `;
        return html;
    }
    collectOptionSettings(field) {
        // 更新选项（如果有）
        if (field.options) {
            const optionInputs = document.querySelectorAll('#optionsContainer input');
            field.options = [];
            for (let i = 0; i < optionInputs.length; i += 2) {
                if (i + 1 < optionInputs.length) {
                    field.options.push({
                        label: optionInputs[i].value,
                        value: optionInputs[i + 1].value
                    });
                }
            }
        }
        field.dataAttribute.multiple = document.getElementById('fieldMultiple').checked ? 'true' : 'false';
    }
}
export default new SelectField;